﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TestNeuralModel
{
    class Neural
    {
        public byte Data = 0;

        public byte Weigh = 0;

        Neural[] Lasts;

        public Neural(params Neural[] Lasts)
        {
            this.Lasts = Lasts;
        }

        public void Operate()
        {
            if (this.Lasts.Length == 0) return;

            int sum = 0;

            foreach (Neural last in this.Lasts)
            {
                sum += last.Data * last.Weigh;
            }

            this.Data = (byte)Math.Min(255, Math.Max(0, sum / this.Lasts.Length));
        }
    }
    /// <summary>
    /// 轴突
    /// </summary>
    class Axon
    {
    }

    /// <summary>
    /// 树突
    /// </summary>
    class Dendrite
    {
        
    }

    /// <summary>
    /// 胞体
    /// </summary>
    class Soma
    {
        
    }

    /// <summary>
    /// 突触
    /// </summary>
    class Synapse
    {
        public byte Data;

        public void Input(byte data)
        {
        }

        public Synapse(Axon axon)
        {
        }
    }
}
